class Solution:
    def increasingTriplet(self, nums: list) -> bool:
        if len(nums) <= 2:
            return False
        smallest, smaller = nums[0], float("inf")
        for num in nums[1:]:
            if num <= smallest:
                smallest = num
            elif num < smaller:
                smaller = num
            elif num > smaller:
                return True
        return False


a = Solution()
print(a.increasingTriplet([1, 2, 3, 4, 5]))
print(a.increasingTriplet([5, 4, 3, 2, 1]))
print(a.increasingTriplet([1, 1, -2, 6, ]))
